import http from "@/api";

import { ResPage } from "@/api/interface";

import { JobVo } from "@/biz/interface/JobType";

import { ModuleFlexJobUrl, ModuleCommonUrl,ModuleMainUrl } from "..";
import { CommonTree } from "@/biz/interface";

const moduleUrl = ModuleFlexJobUrl;
const commModuleUrl = ModuleCommonUrl;
const mainModuleUrl = ModuleMainUrl;

// * 获取发布的岗位列表
export const getFlexjobsVoListApi = (params: {}) => {
  return http.post<ResPage<JobVo>>(moduleUrl + `/workerapi/mypubs`, params);
};

// * 获取等待的岗位列表
export const getAuditFlexjobsVoListApi = (params: {}) => {
  return http.post<ResPage<JobVo>>(moduleUrl + `/workerapi/myaudits`, params);
};

// * 获取售后的岗位列表
export const getAbnormalFlexjobsVoListApi = (params: {}) => {
  return http.post<ResPage<JobVo>>(moduleUrl + `/workerapi/myabnormals`, params);
};

// * 获取评价的岗位列表
export const getCommentFlexjobsVoListApi = (params: {}) => {
  return http.post<ResPage<JobVo>>(moduleUrl + `/workerapi/myevaluates`, params);
};

// * 删除发布的岗位接口
export const deleteFlexjobApi = (params: { id: string }) => {
  return http.post(moduleUrl + `/jobapi/jobremove`, params);
};

// * 下架岗位接口
export const offlineFlexjobApi = (params: { id: string }) => {
  return http.post(moduleUrl + `/jobapi/joboffline`, params);
};

// * 获取招工,零时工岗位 类型列表
export const getFlexjobTypesTreeApi = (params: {}) => {
  return http.post<CommonTree>(moduleUrl + `/jobtypeapi/jobtypetree`, params);
};

// * 获取零工的数据字典
export const getFlexjobDictionarysApi = () => {
  return http.post(commModuleUrl + `/comapi/dictionary`, { tbName: "flexjob" });
};

// * 获取零工的系统标签
export const getFlexjobTagsApi = () => {
  return http.post(moduleUrl + `/jobtagapi/getjobtags`, {});
};

// * 保存零工数据
export const saveFlexjobApi = (parms: {}) => {
  return http.post(moduleUrl + `/jobapi/jobsave`, { ...parms });
};

// * 获取零工数据
export const getFlexjobInfoApi = (parms: {}) => {
  return http.post(moduleUrl + `/jobapi/jobinfo`, { ...parms });
};

// * 发岗人同意申请人的价格
export const confirmApplyPriceApi = (parms: {}) => {
  return http.post(moduleUrl + `/jobapi/jobpuberconfirmquote`, { ...parms });
};

// * 发岗人确认申请人
export const confirmApplyerApi = (parms: {}) => {
  return http.post(moduleUrl + `/jobapi/jobpuberconfirm`, { ...parms });
};

// * 发岗人取消确认申请人
export const cancelConfirmApplyerApi = (parms: {}) => {
  return http.post(moduleUrl + `/jobapi/jobpubercancelconfirm`, { ...parms });
};

// * 发岗人确认申请人
export const confirmJobDoneApi = (parms: {}) => {
  return http.post(moduleUrl + `/jobapi/jobdone`, { ...parms });
};

/********议价相关接口********/
// * 获取零工数据
export const getFlexjobSettleInfoApi = (parms: {}) => {
  return http.post(moduleUrl + `/jobapi/jobapplyinfo`, { ...parms });
};

// * 发岗人回复价格
export const jobpuberTalkPriceApi = (parms: {}) => {
  return http.post(moduleUrl + `/jobapi/jobtalkpay`, { ...parms });
};

// * 发岗人评价岗位接单人
export const jobpuberCommentApi = (parms: {}) => {
  return http.post(moduleUrl + `/jobapi/jobdealscore`, { ...parms });
};

// * 获取零工协议
export const jobFlexjobProtocolApi = (parms: {type:number}) => {
  return http.post(mainModuleUrl + `/web/webarticle`, { ...parms });
};
